package com.jz.banner.screen.utils

import android.widget.Toast
import androidx.annotation.StringRes
import com.jz.banner.screen.ui.App


/**
 * 创建者     Noel
 * 创建时间   2017/12/21 16:19
 */
class ToastUtil {
    companion object {
        private var toast: Toast? = null
        fun showToast(message: String?) {
            if (toast == null) toast = Toast.makeText(App.context, message, Toast.LENGTH_SHORT)
            else toast!!.setText(message)
            toast!!.show()
        }

        fun showToast(@StringRes res: Int) {
            if (toast == null) toast = Toast.makeText(App.context, res, Toast.LENGTH_SHORT)
            else toast!!.setText(res)
            toast!!.show()
        }
    }
}